@extends('admin.layout')
@if(session('master') -> prerogative == '1')
@section('content')
<div class="content-wrapper" style="min-height: 916px;">
     
           <div id="breadcrumbs" class="breadcrumbs">
                <ol class="breadcrumb">
                <li><a href="javascript:void();"><i class="fa fa-home"></i>&nbsp;&nbsp;后台首页</a></li>
                        
                        <li><a href="javascript:void();">权限管理</a></li>    
                        <li><a href="javascript:void();">编辑管理员</a></li>          
                </ol>
            </div>

            @if(session('error'))
              <div class="row">
                <div class="col-xs-6 col-xs-offset-3">
                  <div id="showHidden" class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <h4>  <i class="icon fa fa-check"></i> {{ session('error') }} </h4>
                    
                  </div>
                </div>
              </div>
            @endif

            @if(session('info'))
                <div class="row">
                  <div class="col-xs-6 col-xs-offset-3">
                    <div id="showHidden" class="alert alert-success alert-dismissable">
                      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                      <h4>  <i class="icon fa fa-check"></i> {{ session('info') }} </h4>
                      
                    </div>
                  </div>
                </div>
              @endif


        <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">
            
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 编辑管理员</h3>
                    
                </div>
                <div class="panel-body ">   
                    <!--表单数据-->
                    <form action="{{ url('/admin/admin/update') }}" id="adminHandle" method="post">  {{csrf_field()}} 
                    <input type="hidden" name="id" value="{{ $data -> id}}">                  
                        <!--通用信息-->
                    <div class="tab-content col-md-10">                       
                        <div id="tab_tongyong" class="tab-pane active">                           
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td class="col-sm-2">用户名：</td>
                                    <td class="col-sm-8">
                                        
                                        @if($errors -> has('username'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                            <?php
                                                echo $errors->first('username');  
                                            ?>  
                                            </label>
                                            <input name="username" type="text" placeholder="{{ $data -> username}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input name="username" type="text" value="" name="username" class="form-control" placeholder="{{ $data -> username}}">

                                        @endif
                                    </td>
                                </tr>  
                                <tr>
                                    <td>Email地址：</td>
                                    <td>    
                                      @if($errors -> has('email'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                             <?php
                                                echo $errors->first('email');  
                                            ?>
                                            </label>
                                            <input name="email" name="username" type="text" placeholder="{{ $data -> email}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input type="text" value="" name="email" class="form-control" placeholder="{{ $data -> email}}">
                                        @endif                           
                                    </td>
                                </tr>  
                                <tr>
                                    <td>联系电话：</td>
                                    <td>
                                        @if($errors -> has('phone'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                                <?php
                                                echo $errors->first('phone');  
                                                ?>
                                            </label>
                                            <input name="phone" type="text" placeholder="{{ $data -> phone}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input name="phone" for="inputError" type="text" value="" name="phone" class="form-control" placeholder="{{ $data -> phone}}">


                                        @endif
                             
                                    </td>
                                </tr> 
                                <tr>
                                    <td>登陆密码：</td>
                                    <td>
                                        

                                        @if($errors -> has('password'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                                <?php
                                                echo $errors->first('password');  
                                                ?>
                                                </label>
                                            <input name="password" type="text" placeholder="请输入账户登录密码" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input type="password" value="" name="password" class="form-control" placeholder="请输入6-20位密码">
                                        @endif
                                    </td>
                                </tr>

                                @if($data -> prerogative != 1)
                                <tr>
                                    <td>所属角色：</td>
                                    <td>
                                        <select name="prerogative">
                                            <option 
                                                value="0"
                                                @if($data -> prerogative == 0)
                                                    selected="selected"
                                                @endif
                                            >普通管理员</option>
                                            <option value="1"
                                                @if($data -> prerogative == 1)
                                                    selected="selected"
                                                @endif
                                            >超级管理员</option>                 
                                        </select>    
                                    </td>
                                </tr>
                                @endif                             
                                </tbody> 
                                <tfoot>
                                    <tr>
                                    <td>
                                    </td>
                                    <td class="text-right"><input type="submit" value="保存" class="btn btn-primary"></td></tr>
                                </tfoot>                            
                                </table>
                        </div>                           
                    </div>              
                   </form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
                    </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div>
    <script type="text/javascript">
        
        window.onload = function()
        {

            //自动清楚提示框
            setTimeout("$('#showHidden').hide( )",3000); 
            
        }

    </script>

@endsection
@else
@section('content')
 <div class="content-wrapper">
    <div class="alert alert-danger alert-dismissable">
      <h4><i class="icon fa fa-ban"></i> 非法操作 </h4>
      <h2>！您没有权限访问此页面，请终止当前操作，否则将追究法律责任！</h2>
    </div>
  </div>
@endsection
@endif